﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AODL.Document;
using AODL.Document.TextDocuments;
using AODL.Document.Content.Text;
using AODL.Document.Styles;

namespace _1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public void myMethod()
        {
            TextDocument doc = new AODL.Document.TextDocuments.TextDocument();
            doc.Load("C:\\Users\\Andres Lester\\Desktop\\hi.odt");
            //doc.Load("C:\\Users\\Andres Lester\\Desktop\\r.odt");


            string message = string.Empty;

            Paragraph p = null;
            FormatedText ft = null;

            for (int x = 0; x < doc.Content.Count; x++)
            {

                p = (Paragraph)doc.Content[x];


                for (int y = 0; y < p.MixedContent.Count; y++)
                {
                    try
                    {
                        ft = (FormatedText)p.MixedContent[y];
                    }
                    catch(Exception)
                    {
                        break;
                    }
                    message = string.Empty;

                    TextStyle ts = ft.TextStyle;
                    message = String.Format("Letter: {0}  Color: {1} \n", ft.Text, ts.TextProperties.FontColor);

                    listBox.Items.Add(message);

                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            myMethod();
        }
    }
}